<template>
  <div>
    <header class="site-header jumbotron">
      <div class="container">
        <div class="row">
          <div class="col-xs-12">
            <h1>请发表对VUE的评论</h1>
          </div>
        </div>
      </div>
    </header>
    <div class="container">
      <Add :addComment="addComment"></Add>
      <List :comments="comments" :removeComment="removeComment"></List>
    </div>
  </div>
</template>

<script>
import Add from './components/Add'
import List from './components/List'
export default {
  name: 'App',
  components: {Add, List},
  props: {},
  data() {
    return {
      comments: [{
        name: '张三',
        content: 'Vue hello'
      },
      {
        name: '李四',
        content: 'Vue LISI'
      },
      {
        name: 'BWO',
        content: 'Vue bwo'
      }]
    }
  },
  methods: {
    addComment(comment) {
        this.comments.unshift(comment)
    },
    removeComment(index) {
      this.comments.splice(index, 1)
    }
  }
}
</script>

<style scoped>

</style>
